package com.gxuwz.business.dao.impl;

import org.springframework.stereotype.Repository;

import java.util.List;
import com.gxuwz.business.dao.impl.BaseDaoImpl;
import com.gxuwz.business.entity.SysRole;
import com.gxuwz.business.entity.SysUser;


@Repository("sysRoleDAO")
public class SysRoleDAO extends BaseDaoImpl<SysRole>{
	
	/**
	 * 新增角色
	 * @param sysRole
	 */
	public void addRole(SysRole sysRole){
		getHibernateTemplate().save(sysRole);
	}
	
	/**
	 * 删除角色
	 * @param sysRole
	 */
	public void delete(SysRole sysRole){
		getHibernateTemplate().delete(sysRole);
		
	}
	/**
	 * 修改角色
	 */
	public void update(SysRole sysRole){
		getHibernateTemplate().update(sysRole);
	}

	@SuppressWarnings("unchecked")
	public List<String> findRightByRoleId(String roleId) {
		String hql = "select resourcePath from SysRight where rightId in (select rightId from SysRoleRight where roleId = ?)";
		return (List<String>) getHibernateTemplate().find(hql, roleId);
	}
	
}